package cn.zt.controller;

import cn.zt.dto.ResultDTO;
import cn.zt.model.Navigation;
import cn.zt.service.NavigationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: zt
 * @Date: 2020/6/8 16:31
 */
@RestController
@RequestMapping("/navigation")
@Api(value = "navigation", description = "导航栏接口")
public class NavigationController {
    @Autowired
    private NavigationService navigationService;

    @ApiOperation("获取导航数据")
    @GetMapping("/queryNavigation")
    public ResultDTO queryNavigation() {
       List<Navigation> navigation = new ArrayList<>();
        try {
            navigation =  navigationService.queryNavigation();

        } catch (Exception e) {
            return ResultDTO.isFail(e);
        }

        return ResultDTO.isOk().data(navigation);
    }
}
